/**
 * 
 */
package net.jadoth.sqlengine.internal;

import java.util.LinkedList;
import java.util.List;

import net.jadoth.sqlengine.aspects.QueryExecutionAspect;
import net.jadoth.sqlengine.aspects.QueryExecutionContext;

/**
 * @author Thomas Muenz
 *
 */
public class QueryExecutors<R>
{
	///////////////////////////////////////////////////////////////////////////
	// instance fields //
	////////////////////
	
	private List<QueryExecutionAspect<QueryExecutionContext<R>, R>> preAssemblyExecutors = null;
	private List<QueryExecutionAspect<QueryExecutionContext<R>, R>> preExecutionExecutors = null;
	private List<QueryExecutionAspect<QueryExecutionContext<R>, R>> executionExecutors = null;
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// getters          //
	/////////////////////
	
	/**
	 * @return the preAssemblyExecutors
	 */
	public List<QueryExecutionAspect<QueryExecutionContext<R>, R>> getPreAssemblyExecutors()
	{
		return preAssemblyExecutors;
	}
	/**
	 * @return the preExecutionExecutors
	 */
	public List<QueryExecutionAspect<QueryExecutionContext<R>, R>> getPreExecutionExecutors()
	{
		return preExecutionExecutors;
	}
	/**
	 * @return the postExecutionExecutors
	 */
	public List<QueryExecutionAspect<QueryExecutionContext<R>, R>> getPostExecutionExecutors()
	{
		return executionExecutors;
	}
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// setters          //
	/////////////////////	
	
	/**
	 * @param preAssemblyExecutors the preAssemblyExecutors to set
	 */
	public QueryExecutors<R> setPreAssemblyExecutors(List<QueryExecutionAspect<QueryExecutionContext<R>, R>> preAssemblyExecutors)
	{
		this.preAssemblyExecutors = preAssemblyExecutors;
		return this;
	}
	/**
	 * @param preExecutionExecutors the preExecutionExecutors to set
	 */
	public QueryExecutors<R> setPreExecutionExecutors(List<QueryExecutionAspect<QueryExecutionContext<R>, R>> preExecutionExecutors)
	{
		this.preExecutionExecutors = preExecutionExecutors;
		return this;
	}
	/**
	 * @param postExecutionExecutors the postExecutionExecutors to set
	 */
	public QueryExecutors<R> setPostExecutionExecutors(List<QueryExecutionAspect<QueryExecutionContext<R>, R>> postExecutionExecutors)
	{
		this.executionExecutors = postExecutionExecutors;
		return this;
	}
	
	
	
	///////////////////////////////////////////////////////////////////////////
	// declared methods //
	/////////////////////
	
	public List<QueryExecutionAspect<QueryExecutionContext<R>, R>> preAssemblyExecutors()
	{
		if(this.preAssemblyExecutors == null){
			this.preAssemblyExecutors = new LinkedList<QueryExecutionAspect<QueryExecutionContext<R>,R>>();
		}
		return this.preAssemblyExecutors;
	}
	
	public List<QueryExecutionAspect<QueryExecutionContext<R>, R>> preExecutionExecutors()
	{
		if(this.preExecutionExecutors == null){
			this.preExecutionExecutors = new LinkedList<QueryExecutionAspect<QueryExecutionContext<R>,R>>();
		}
		return this.preExecutionExecutors;
	}
	
	public List<QueryExecutionAspect<QueryExecutionContext<R>, R>> postExecutionExecutors()
	{
		if(this.executionExecutors == null){
			this.executionExecutors = new LinkedList<QueryExecutionAspect<QueryExecutionContext<R>,R>>();
		}
		return this.executionExecutors;
	}
	
	// (22.07.2010 TM)FIXME: invokeAssembly
//	public Object[] invokeAssembly(QueryExecutionContext<R> context)
//	{
//		if(this.preAssemblyExecutors == null) return null;
//		
//		for(QueryExecutionAspect<QueryExecutionContext<R>, R> executor : this.preAssemblyExecutors)
//		{
//			
//		}
//	}
	
	
}

